/*
* $Id: led.c,v 1.2 2007/11/27 04:04:13 sunny Exp $
*/
/*******************************************************************************

       UBEC (Uniband Electronic Corp.)

       Project: U-NET01, Ubiquitous network platform

       File: led.c

       Version: 0.3.0

       Usage: UZ2400 SPI Interface Function

       Platform: U-NET01 DK with Keil 8051 C compiler

       Reference:

               Silicon Laboratories: C8051F124, C8051F340

               UBEC: UZ2400, UZ2410

       Note :

               Copyright (C) 2007 Uniband Electronic Corporation, All rights reserved

********************************************************************************/

#include "unet.h"

/*******************************************************************************
	RF Link LED control
*******************************************************************************/
void Link_LED_On(void)
{
	_Link_LED_On();
}
void Link_LED_Off(void)
{
	_Link_LED_Off();
}
void Link_LED_Toggle(void)
{
	_Link_LED_Toggle();
}
BOOL Is_Link_LED_On(void)
{
	return(_Is_Link_LED_On());
}

/*******************************************************************************
	RF activity LED control
*******************************************************************************/
void RxTx_LED_On(void)
{
#if defined(SAME_LED_LINK_RXTX) && SAME_LED_LINK_RXTX
	UnetSys.Flag.JoinNetwork ? _RxTx_LED_Off() : _RxTx_LED_On();
#else
	_RxTx_LED_On();
#endif
}
void RxTx_LED_Off(void)
{
#if defined(SAME_LED_LINK_RXTX) && SAME_LED_LINK_RXTX
	UnetSys.Flag.JoinNetwork ? _RxTx_LED_On() : _RxTx_LED_Off();
#else
	_RxTx_LED_Off();
#endif
}
void RxTx_LED_Toggle(void)
{
	_RxTx_LED_Toggle();
}
BOOL Is_RxTx_LED_On(void)
{
	return(_Is_RxTx_LED_On());
}

/*******************************************************************************
	UART activity LED control
*******************************************************************************/
void UART_LED_On(void)
{
#if defined(SAME_LED_UART_USER) && SAME_LED_UART_USER
	poll.flag.up_poll_flg ? _UART_LED_Off() : _UART_LED_On();
#else
	_UART_LED_On();
#endif
}

#pragma message (__LOC__ "UART_LED_Off() is called by interrupt service routine.")
#if defined(__C51__)
#pragma NOAREGS
#endif
void UART_LED_Off(void)
{
#if defined(SAME_LED_UART_USER) && SAME_LED_UART_USER
	poll.flag.up_poll_flg ? _UART_LED_On() : _UART_LED_Off();
#else
	_UART_LED_Off();
#endif
}
#if defined(__C51__)
#pragma AREGS
#endif

void UART_LED_Toggle(void)
{
	_UART_LED_Toggle();
}
BOOL Is_UART_LED_On(void)
{
	return(_Is_UART_LED_On());
}

/*******************************************************************************
	User LED control
*******************************************************************************/
void User_LED_On(void)
{
	_User_LED_On();
}
void User_LED_Off(void)
{
	_User_LED_Off();
}
void User_LED_Toggle(void)
{
	_User_LED_Toggle();
}
BOOL Is_User_LED_On(void)
{
	return(_Is_User_LED_On());
}


/*******************************************************************************
	UBEC chip RESET control
*******************************************************************************/
void UBEC_Activate_RESET(void)
{
	_UBEC_Activate_RESET();		// Put the RESET to Low
}
void UBEC_Deactivate_RESET(void)
{
	_UBEC_Deactivate_RESET();	// Put the RESET to High
}

/*******************************************************************************
	UBEC chip SEN control
*******************************************************************************/
#pragma message (__LOC__ "UBEC_Activate_SEN() is called by interrupt service routine and main program.")
#if defined(__C51__)
#pragma NOAREGS
#endif
void UBEC_Activate_SEN(void)
{
	_UBEC_Activate_SEN();		// Put the CS to Low
}
#pragma message (__LOC__ "UBEC_Deactivate_SEN() is called by interrupt service routine and main program.")
void UBEC_Deactivate_SEN(void)
{
	_UBEC_Deactivate_SEN();		// Put the CS to High
}
#if defined(__C51__)
#pragma AREGS
#endif
